﻿//-----------------------------------------------------------------------------
// <copyright file="FrameworkObjectExtensions.cs" company="William E. Kempf">
//     Copyright (c) William E. Kempf.
// </copyright>
//-----------------------------------------------------------------------------

namespace Onyx.Windows
{
    using System.Windows;

    public static class FrameworkObjectExtensions
    {
        public static IFrameworkObject AsFrameworkObject(this DependencyObject self)
        {
            FrameworkElement fe = self as FrameworkElement;
            if (fe != null)
            {
                return new FrameworkElementWrapper(fe);
            }

#if WPF
            FrameworkContentElement fce = self as FrameworkContentElement;
            if (fce != null)
            {
                return new FrameworkContentElementWrapper(fce);
            }
#endif

            return null;
        }
    }
}
